export default {
  state() {
    return {
      list: [],
      arr: [1, 2, 3, 4, 5, 6, 7, 8, 9],
    };
  },
  getters: {
    oddArr(state) {
      return state.arr.filter((item) => item % 2);
    },
  },
  mutations: {
    getData(state, data) {
      state.list = data;
    },
  },
  actions: {
    getDataAsync({ commit }) {
      fetch("http://101.35.148.193:3000/api/rated/list")
        .then((response) => response.json())
        .then((res) => {
          // console.log(res);
          commit("getData", res.data);
        });
    },
  },
};
